diff --git a/source/diagnostic.cpp b/source/diagnostic.cpp
index edc27c8..77c29d7 100644
--- a/source/diagnostic.cpp
+++ b/source/diagnostic.cpp
@@ -37,7 +37,7 @@ spv_diagnostic spvDiagnosticCreate(const spv_position position,
   diagnostic->position = *position;
   diagnostic->isTextSource = false;
   memset(diagnostic->error, 0, length);
-  strncpy(diagnostic->error, message, length);
+  memcpy(diagnostic->error, message, length);
   return diagnostic;
 }
 
